{% extends 'base.html' %}
{% block app_content %}
{#    <table>#}
{#        <tr valign="top">#}
{#            <td><img src="{{ user.avatar(128) }}"></td>#}
{#            <td>#}
{#                <h1>User:{{ user.username }}</h1>#}
{#                {% if user.about_me %}<p>{{ user.about_me }}</p>{% endif %}#}
{#                {% if user.last_seen %}<p>Last seen on:{{ user.last_seen }}</p>{% endif %}#}
{#                <p>{{ user.followers.count() }}follows, {{ user.followed.count() }} following.</p>#}
{#                <!--编辑资料页面添加-->#}
{#                {% if user == current_user %}#}
{#                    <p><a href="{{ url_for('edit_profile') }}">Edited your profile</a> </p>#}
{#                {% elif not current_user.is_following(user) %}#}
{#                    <p><a href="{{ url_for('follow',username=user.username) }}">Follow</a> </p>#}
{#                {% else %}#}
{#                    <p><a href="{{ url_for("unfollow",username=user.username) }}">Unfollow</a></p>#}
{#                {% endif %}#}
{#            </td>#}
{#        </tr>#}
{#    </table>#}
{#    <hr>#}
    <table class="table table-hover">
        <tr>
            <td width="256px"><img src="{{ user.avatar(256) }}"></td>
            <td>
                <h1>User:{{ user.username }}</h1>
                {% if user.about_me %}<p>{{ user.about_me }}</p>{% endif %}
{#                {% if user.last_seen %}<p>Last seen on:{{ user.last_seen }}</p>{% endif %}#}
                {% if user.last_seen %}<p>Last seen on:{{ moment(user.last_seen).format('LLL') }}</p>{% endif %}
                <p>{{ user.followers.count() }}follows, {{ user.followed.count() }} following.</p>
                <!--编辑资料页面添加-->
                {% if user == current_user %}
                    <p><a href="{{ url_for('edit_profile') }}">Edited your profile</a> </p>
                {% elif not current_user.is_following(user) %}
                    <p><a href="{{ url_for('follow',username=user.username) }}">Follow</a> </p>
                {% else %}
                    <p><a href="{{ url_for("unfollow",username=user.username) }}">Unfollow</a></p>
                {% endif %}
            </td>

        </tr>
    </table>

    {% for post in posts %}
        <!--使用include 来调用子模板-->
        {% include '_post.html' %}
    {% endfor %}

    <nav aria-label="...">
        <ul class="pager">
            <li class="previous{% if not prev_url %} disabled{% endif %}">
                <a href="{{ prev_url or '#' }}">
                    <span aria-hidden="true">&larr;</span> Newer posts
                </a>
            </li>
            <li class="next{% if not next_url %} disabled{% endif %}">
                <a href="{{ next_url or '#' }}">
                    Older posts <span aria-hidden="true">&rarr;</span>
                </a>
            </li>
        </ul>
    </nav>

{#    {% if prev_url %}#}
{#    <a href="{{ prev_url }}">后一页</a>#}
{#    {% endif %}#}
{#    {% if next_url %}#}
{#    <a href="{{ next_url }}">前一页</a>#}
{#    {% endif %}#}
{% endblock %}